// pages/article/article.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    data:'',
    job:[],
    jobList:[],
    id:'',
    isClick:false,
    jobStorage:[],
    jobId:'',
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let id=options.id;
    wx.request({
      url: 'http://www.healthcare.com/api/lx/health_detail?id='+id,
      success:res=>{
        console.log(res);
        this.setData({
          data:res.data.data
        })
      }
    })
  },

//收藏
haveSave(e){
  if(!this.data.isClick == true){
    let jobData = this.data.jobStorage;
    jobData.push({
      jobid:jobData.length,
      id:this.data.job.id
    })
    wx.setStorageSync('jobData', jobData);
    wx.showToast({
      title: '已收藏',
    });
  }else{
    wx.showToast({
      title: '已取消收藏',
    })
  }
  this.setData({
    isClick:!this.data.isClick
  })
},

})